﻿
@{
    ViewBag.Title = "公司信息维护";
    ServiceSingleDataResult<CorporationDto> result = ViewBag.Result ?? null;
}
@model CorporationDto

@if (result != null && result.Successful)
{
    <div class="wrapper wrapper-content animated fadeInRight ">
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-12">
                <h2>Basic Form</h2>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item">
                        <a href="index.html">Home</a>
                    </li>
                    <li class="breadcrumb-item">
                        <a>Corporation</a>
                    </li>
                    <li class="breadcrumb-item active">
                        <strong>Edit</strong>
                    </li>
                </ol>
            </div>
            @*<div class="col-lg-2 hidden">

                </div>*@
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>@ViewBag.Title <small>请填写相关数据.</small></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="FormCorporationEdit" enctype="multipart/form-data" method="post" asp-action="Edit" asp-controller="Corporation">
                            <div class="form-group row">
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.Name"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司简称" class="form-control" asp-for="@Model.Name" value="@(result.Successful && Model.Name.IsNotNull() ? Model.Name : string.Empty)" />
                                            <span asp-validation-for="@Model.Name" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.FullName"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司全称" class="form-control" asp-for="@Model.FullName" value="@(result.Successful && Model.FullName.IsNotNull() ? Model.FullName : string.Empty)" />
                                            <span asp-validation-for="@Model.FullName" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.BusinessLicense"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司营业执照/组织机构代码/税务登记编号" class="form-control" asp-for="@Model.BusinessLicense" value="@(result.Successful && Model.BusinessLicense.IsNotNull() ? Model.BusinessLicense : string.Empty )" />
                                            <span asp-validation-for="@Model.BusinessLicense" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">

                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.LegalPerson"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司法人" class="form-control" asp-for="@Model.LegalPerson" value="@(result.Successful && Model.LegalPerson.IsNotNull() ? Model.LegalPerson : string.Empty)" />
                                            <span asp-validation-for="@Model.LegalPerson" class="text-danger"></span>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.LegalPersonIDCardNo"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司法人证件号" class="form-control" asp-for="@Model.LegalPersonIDCardNo" value="@(result.Successful && Model.LegalPersonIDCardNo.IsNotNull() ? Model.LegalPersonIDCardNo : string.Empty) " />
                                            <span asp-validation-for="@Model.LegalPersonIDCardNo" class="text-danger"></span>
                                        </div>
                                    </div>

                                </div>

                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.LegalPersonPhone"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司法人手机号" class="form-control" asp-for="@Model.LegalPersonPhone" value="@(result.Successful && Model.LegalPersonPhone.IsNotNull() ? Model.LegalPersonPhone : string.Empty)" />
                                            <span asp-validation-for="@Model.LegalPersonPhone" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.Telephone"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司联系电话" class="form-control" asp-for="@Model.Telephone" value="@(result.Successful && Model.Telephone.IsNotNull() ? Model.Telephone : string.Empty)" />
                                            <span asp-validation-for="@Model.Telephone" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">

                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.FaxNumber"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司传真号" class="form-control" asp-for="@Model.FaxNumber" value="@(result.Successful && Model.FaxNumber.IsNotNull() ? Model.FaxNumber : string.Empty)" />
                                            <span asp-validation-for="@Model.FaxNumber" class="text-danger"></span>
                                        </div>

                                    </div>

                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-6">

                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.SupportEMail"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="填写公司服务支持邮件地址" class="form-control" asp-for="@Model.SupportEMail" value="@(result.Successful && Model.SupportEMail.IsNotNull() ? Model.SupportEMail : string.Empty)" />
                                            <span asp-validation-for="@Model.SupportEMail" class="text-danger"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.AreaID"></label>
                                        <div class="col-md-8">
                                            <select class="form-control col selectpicker show-tick" data-live-search="true" data-style="btn-success" data-size="11" data-width="fit" data-actions-box="true" title="请选择" name="AreaID" id="seltProvinceAreaID">
                                            </select>
                                            <select class="form-control col selectpicker show-tick" data-live-search="true" data-style="btn-success" data-size="11" data-width="fit" data-actions-box="true" title="请选择" name="AreaID" id="seltCityAreaID">
                                            </select>
                                            <select class="form-control col selectpicker show-tick" data-live-search="true" data-style="btn-success" data-size="11" data-width="fit" data-actions-box="true" title="请选择" name="AreaID" id="seltCistrictAreaID">
                                            </select>
                                            <select class="form-control col selectpicker show-tick" data-live-search="true" data-style="btn-success" data-size="11" data-width="auto" data-actions-box="true" title="请选择" name="AreaID" id="seltStreetAreaID">
                                            </select>
                                            <span asp-validation-for="@Model.AreaID" class="text-danger"></span>
                                            <i class="form-control-feedback glyphicon glyphicon-remove" data-bv-icon-for="@Model.AreaID" style=string.Empty></i>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-6">

                                    <div class="row">
                                        <label class="col-md-3 offset-md-1 col-form-label" asp-for="@Model.CorporationAddress"></label>
                                        <div class="col-md-8">
                                            <input type="text" placeholder="请填写公司所在区划之后的详细地址" class="form-control" asp-for="@Model.CorporationAddress" value="@(Model.CorporationAddress.IsNotNull() ? Model.CorporationAddress : string.Empty)" />
                                            <span asp-validation-for="@Model.CorporationAddress" class="text-danger"></span>
                                        </div>
                                    </div>

                                </div>
                                <div class="col-md-6">

                                    <div class="row">
                                        <label asp-for="@Model.Remarks" class="col-md-3 offset-md-1 col-form-label"></label>
                                        <div class="col-md-8">
                                            <textarea class="form-control" asp-for="@Model.Remarks" rows="3" placeholder="备注信息（选填）">value="@(result.Successful && Model.Remarks.IsNotNull() ? Model.Remarks : string.Empty)"</textarea>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <input type="hidden" class="form-control" asp-for="@Model.ID" value="@(result.Successful ? Model.ID : -1)" />

                            <input type="hidden" id="hidResultCodeInValid" name="hidResultCodeInValid" value="@((int)EnumCollection.ResultCode.ModelStateInValid)" />
                            <input type="hidden" id="hidResultCodeSuccessful" name="hidResultCodeSuccessful" value="@((int)EnumCollection.ResultCode.Successful)" />
                            <input type="hidden" class="form-control" name="Successful" id="Successful" value="@(result.Successful ? 1 : 0)" message="@(result.Message.IsNotNull() ? result.Message : string.Empty)" frompageuri="@(result.PrevURI)" />
                            <input type="hidden" id="hidAreaIDs" name="hidAreaIDs" value="@Model.AreaIDs" />

                            <div class="form-group row">
                                <div class="col-md-4 col-md-offset-2">
                                    <button class="btn btn-white btn-sm" type="button">Cancel</button>
                                    <button class="btn btn-primary btn-sm" type="button" id="btnSubmit">Save changes</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
}
else
{
    <input type="hidden" class="form-control" name="Successful" id="Successful" value="@(result.Successful ? 1 : 0)" message="@(result.Message.IsNotNull() ? result.Message : string.Empty)" frompageuri="@(result.PrevURI)" />
}
@section Scripts {
    @{await Html.RenderPartialAsync("_BootstrapSelectPartial"); }
    @{await Html.RenderPartialAsync("_BootstrapValidatorPartial"); }
    @{await Html.RenderPartialAsync("_AjaxFromPartial"); }
    <script src="~/js/Corporation/Edit.js" type="text/javascript" asp-append-version="true"></script>
}

